global
    log /dev/log    local0
    log /dev/log    local1 notice
    stats timeout 30s
    user haproxy
    group haproxy
    daemon

defaults
    log global
    mode tcp
    option tcplog
    option dontlognull
    timeout connect 5000
    timeout client  50000
    timeout server  50000

frontend k3s_master_frontend
    bind *:6443
    mode tcp
    default_backend k3s_master_nodes

frontend k3s_agent_frontend
    bind *:80
    mode tcp
    default_backend k3s_agent_nodes

backend k3s_master_nodes
    mode tcp
    balance roundrobin
    option tcp-check
    server k3s_node1 10.0.16.132:6443 check
    server k3s_node2 10.0.16.129:6443 check
    server k3s_node3 10.0.16.127:6443 check

backend k3s_agent_nodes
    mode tcp
    balance roundrobin
    option tcp-check
    server k3s_node1 10.0.16.133:80 check
    server k3s_node2 10.0.16.34:80 check

frontend k3s_agent_frontend_https
    bind *:443
    mode tcp
    default_backend k3s_agent_nodes_https

backend k3s_agent_nodes_https
    mode tcp
    balance roundrobin
    option tcp-check
    server k3s_node1 10.0.16.133:443 check
    server k3s_node2 10.0.16.34:443 check

frontend prometheus
  bind :8405
  mode http
  http-request use-service prometheus-exporter
  no log
